{extend name="base/form_base" /}
{block name="style"}
<style type="text/css">

</style>
{/block}
{block name="content"}
<div class="layui-fluid">
<form class="layui-form" id='edit_form' onsubmit="return false">
  <input type="hidden" name="id" value="{$data['id']}" >
<!--   <blockquote class="layui-elem-quote"></blockquote> -->
  <div class="layui-row">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名:</label>
        <div class="layui-input-inline">
          <input type="text" value="{$data.username}" class="layui-input" name="username">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话：</label>
        <div class="layui-input-inline">
          <input type="text" value="{$data.phone}" class="layui-input" name="phone">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登录密码：</label>
        <div class="layui-input-inline">
          <input type="text" value="" class="layui-input" placeholder="无修改则放空" name="password">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">交易密码：</label>
        <div class="layui-input-inline">
          <input type="text" value="" placeholder="无修改则放空" class="layui-input" name="paypass">
        </div>
    </div>


    <div class="layui-form-item">
      <label class="layui-form-label">登录状态：</label>
      <div class="layui-input-block">
        {if $data.status == 1}
          <input type="radio" name="status" value="1" title="正常" checked="">
          <input type="radio" name="status" value="0" title="冻结">
        {else /}
          <input type="radio" name="status" value="1" title="正常">
          <input type="radio" name="status" value="0" title="冻结" checked="">
        {/if}
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">提币状态：</label>
      <div class="layui-input-block">
        {if $data.out_status == 1}
          <input type="radio" name="out_status" value="1" title="正常" checked="">
          <input type="radio" name="out_status" value="0" title="冻结">
        {else /}
          <input type="radio" name="out_status" value="1" title="正常">
          <input type="radio" name="out_status" value="0" title="冻结" checked="">
        {/if}
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">静态收益状态：</label>
      <div class="layui-input-block">
        {if $data.static_profit_status == 1}
          <input type="radio" name="static_profit_status" value="1" title="正常" checked="">
          <input type="radio" name="static_profit_status" value="0" title="禁止">
        {else /}
          <input type="radio" name="static_profit_status" value="1" title="正常">
          <input type="radio" name="static_profit_status" value="0" title="禁止" checked="">
        {/if}
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">推广收益状态：</label>
      <div class="layui-input-block">
        {if $data.invite_profit_status == 1}
          <input type="radio" name="invite_profit_status" value="1" title="正常" checked="">
          <input type="radio" name="invite_profit_status" value="0" title="禁止">
        {else /}
          <input type="radio" name="invite_profit_status" value="1" title="正常">
          <input type="radio" name="invite_profit_status" value="0" title="禁止" checked="">
        {/if}
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">团队收益状态：</label>
      <div class="layui-input-block">
        {if $data.team_profit_status == 1}
          <input type="radio" name="team_profit_status" value="1" title="正常" checked="">
          <input type="radio" name="team_profit_status" value="0" title="禁止">
        {else /}
          <input type="radio" name="team_profit_status" value="1" title="正常">
          <input type="radio" name="team_profit_status" value="0" title="禁止" checked="">
        {/if}
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">等级：</label>
      <div class="layui-input-inline">
        <select class="layui-input" name='level'>
          {foreach $level as $val}
            {if $val.level == $data.level}<option value="{$val.level}" selected="selected">{$val.name}</option>
            {else /}<option value="{$val.level}">{$val.name}</option>
            {/if}
          {/foreach}
        </select>
      </div>
    </div>
  
    <div class="layui-input-inline" style="width: 80px">
      <button class="layui-btn" onclick="ajax()" lay-filter="formDemo">确定 </button>
    </div>
  </div>
</form>
</div>  
{/block}
{block name="script"}
<script type="text/javascript">
  function ajax(){
    var post_data = $('#edit_form').serialize();
    $.ajax({
            url:"{:url('admin/User/editUser')}",
            type:"POST",
            data:post_data,
            success:function(ret){
                if (ret.code == 0) {
                  layer.msg('操作成功');
                  parent.$(".layui-laypage-btn")[0].click();
                }
                if (ret.code == 1) {
                    layer.msg(ret.msg);
                }
            }
        });
  }
</script> 
{/block}